<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  medias
 */

class m_medias_actions_block_AddMediaAction extends m_backoffice_extends_FormModal
{
	public function execute()
	{
		$folder = $this->getDocumentProvider()->getByUniqueId($this->getRequestParameter("docId"), $this->getRequestParameter("docLang"));

        if($folder instanceof m_backoffice_documents_Folder)
        {
            $this->addToModel("mce", $this->getRequestParameter("mce"));
            $this->addToModel("folder", $folder);
            $this->addToModel("backLang", $this->getDisplayLang());
            $this->setView('success');
        }
	}	
	
	public function validate()
	{
		return $this->getUserContext()->hasRight(array("backoffice_accessBo", "medias_Add"));
	}
	
	public function errorHandler()
	{
		return null;
	}
}